#!/bin/bash
filename="test.data"
line_no=0
mod=0
green='\e[0;32m'
red='\e[0;31m'
NC='\e[0m' # No Color
todo='TODO.*'
error=0
while read -r line
do
    let line_no+=1
    let mod=line_no%3

    if [ $mod -eq 1 ]; then
        if [[ $line =~ $todo ]]; then
            continue
        fi
        res=`./test.sh "$line"`
        echo "$line / $res"
    fi

    if [ $mod -eq 2 ]; then
        if [[ $line =~ $todo ]]; then
            continue
        fi
        echo "$line"
        if [ "$line" == "$res" ]; then
            echo -e "${green}PASS${NC}"
        else
            let "error+=1"
            echo -e "${red}FAIL${NC}"
#            exit
        fi
    fi
done < "$filename"

echo ""
echo ""
if [ $error -gt 0 ]; then
    echo -e "${red}TESTS FAIL${NC}"
else
    echo -e "${green}TESTS PASS${NC}"
fi

